package com.hui.platform.falseworkapi.common.swagger;

import com.github.xiaoymin.swaggerbootstrapui.annotations.EnableSwaggerBootstrapUI;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Swagger2全局配置
 * <p>
 * UI配置--@EnableSwaggerBootstrapUI
 * 开启Swagger文档--@EnableSwagger2
 *
 * @author hui
 * @date 2020/04/13
 */
@Configuration
@EnableSwagger2
@EnableSwaggerBootstrapUI
public class Swagger2GlobalConfig {

    //------------------Docket集----------------------------
    @Bean
    public Docket allApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("falsework-全部接口集")
                .apiInfo(apiInfo())
                .select()
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("FalseWork的api文档")
                .description("FalseWork接口文档详细信息")
                .version("1.0")
                .build();
    }

}
